home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Libraries / 3DGPL 1.0 / CODE / HARDWARE / WIN-32 / HARDWARE.H < prev   
Encoding:
C/C++ Source or Header  |  1995-06-20  |  2.7 KB  |  77 lines  |  [TEXT/MACA]

  1. #ifndef _HARDWARE_H_
  2. #define _HARDWARE_H_
  3.  
  4. /** 3DGPL *************************************************\
  5.  *  (MS-WINDOWS-32, 386+, 8bit deep modes, 32bit complers)*
  6.  *  Header for hardware specific stuff.                   * 
  7.  *                                                        *
  8.  *  hardware.c               hardware specific stuff.     *
  9.  *                                                        *
  10.  *  (6/1995) By Sergei Savhenko. (savs@cs.mcgill.ca).     *
  11.  *  Copyright (c) 1995 Sergei Savchenko.                  *
  12.  *  THIS SOURCE CODE CAN'T BE USED FOR COMERCIAL PURPOSES *
  13.  *  WITHOUT AUTHORISATION                                 *
  14. \**********************************************************/
  15.  
  16. #include <windows.h>                        /* all the MS stuff */
  17. #include <string.h>                         /* memset memcpy */
  18. #define main _main                          /* to accomodate windows */
  19.  
  20. typedef short signed_16_bit;                /* compiler/mashine dependent */
  21. typedef int   signed_32_bit;           
  22. typedef unsigned short unsigned_16_bit;
  23. typedef unsigned int   unsigned_32_bit;
  24.  
  25. void HW_set_int(int *dst,long lng,int val);
  26. #define HW_set_char(dst,lng,val)  memset(dst,val,lng)
  27. #define HW_copy_int(src,dst,lng)  memcpy(dst,src,lng*sizeof(int))
  28. #define HW_copy_char(src,dst,lng) memcpy(dst,src,lng)
  29.  
  30. #define HW_SCREEN_X_SIZE         320             
  31. #define HW_SCREEN_Y_SIZE         200        /* number of pixels total */
  32.  
  33. #define HW_SCREEN_X_MAX          319
  34. #define HW_SCREEN_Y_MAX          199        /* number of maximum pixel */
  35.  
  36. #define HW_SCREEN_X_CENTRE       160
  37. #define HW_SCREEN_Y_CENTRE       100        /* middle of the screen */
  38.  
  39. #define HW_COLOURMAP_SIZE_CHAR 64000L       /* bytes in the colourmap */
  40. #define HW_COLOURMAP_SIZE_INT  16000L       /* ints in the colourmap */
  41.  
  42. struct HW_colour                            /* describes colour */
  43. {
  44.  int hw_r;
  45.  int hw_g;
  46.  int hw_b;                                  /* intensity components */
  47. };
  48.  
  49. int HW_open_screen(char *display_name,
  50.                    char *screen_name, 
  51.            struct HW_colour palette[256],
  52.                    unsigned char *colourmap
  53.           );
  54. void HW_blit(void);
  55. void HW_close_screen(void);
  56.  
  57. #define HW_KEY_ARROW_LEFT  VK_LEFT
  58. #define HW_KEY_ARROW_RIGHT VK_RIGHT
  59. #define HW_KEY_ARROW_UP    VK_UP
  60. #define HW_KEY_ARROW_DOWN  VK_DOWN
  61.  
  62. #define HW_KEY_PLUS        VK_ADD
  63. #define HW_KEY_MINUS       VK_SUBTRACT
  64.  
  65. #define HW_KEY_ENTER       VK_RETURN
  66. #define HW_KEY_SPACE       VK_SPACE
  67. #define HW_KEY_TAB         VK_TAB           /* all i can think of */ 
  68.  
  69. void HW_run_event_loop(void (*application_main)(void),
  70.                        void (*application_key_handler)(int key_code)
  71.                       );
  72. void HW_quit_event_loop(void);
  73.  
  74. /**********************************************************/
  75.  
  76. #endif
  77.